package org.linlinjava.litemall.taobaoke.sdk;

import com.taobao.api.ApiException;
import com.taobao.api.DefaultTaobaoClient;
import com.taobao.api.TaobaoClient;
import com.taobao.api.request.TbkItemInfoGetRequest;
import com.taobao.api.response.TbkItemInfoGetResponse;
import org.junit.Test;

import java.util.List;

/**
 * @author haoting.wang
 * @date 2019-07-26 15:19
 **/
public class TaobaokeUtil {

    public final static  String SERVER_URL = "http://gw.api.taobao.com/router/rest";

    public final static  String APP_KEY = "27712257";

    public final static  String APP_SECRET = "274447c0dc6dae073e7a32291cf259b2";


    public static void main(String[] args) {

    }

    public static List<TbkItemInfoGetResponse.NTbkItem> getItemInfo(String num_iids,String ip) throws ApiException {

        TaobaoClient client = new DefaultTaobaoClient(SERVER_URL, APP_KEY, APP_SECRET);
        TbkItemInfoGetRequest req = new TbkItemInfoGetRequest();
        req.setNumIids(num_iids);
        req.setPlatform(1L);
        req.setIp(ip);
        TbkItemInfoGetResponse rsp = client.execute(req);

        return rsp.getResults();
    }

}
